package com.yhsx.jenkins.d2.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * 测试接口
 *
 * @author slf
 * @since 2024/5/10 9:02
 **/
@Controller
public class IndexController {
    Logger log = LoggerFactory.getLogger(IndexController.class);

    @RequestMapping("/")
    public String html() {
        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        HttpServletRequest request = attributes.getRequest();
        log.info("端口：{}",request.getServerPort());
        return "index.html";
    }
}
